package tech.aistar.corejava.day10;

import java.util.Date;

/**
 * Created by 豆梦寒 on 2019/7/27.
 */
public class DataDemo {
    public static void main(String[] args) {
        //获取当前系统时间
        Date d = new Date();
        System.out.println(d);
        //利用指定的年月日来构建对象
        //year - 1900
        //month范围[0-11]
        Date dt = new Date(2019-1900,4,6);
        System.out.println(dt);

        //获取当前系统时间的毫秒数
        long time = d.getTime();
        System.out.println(time);

        System.out.println(System.currentTimeMillis());

        //Date(long date); date t = new Date(xxx);
        //计算出3天之后的毫秒数
        long afterThreeDay = System.currentTimeMillis()+3L*24*60*60*1000;
        System.out.println(afterThreeDay);
        //利用毫秒重新构建一个date对象
        Date td = new Date(afterThreeDay);
        System.out.println(td);


    }
}
